import pandas as pd
import os
import sys

sys.path.append(os.path.abspath(os.path.join(os.getcwd(), "../")))

from src2.OomMonitor import OomMonitor
from src2.EchartView import EchartView
from src2.FileMonitor import FileMonitor
from src2.MonitorView import MonitorView
from src2.RankMonitor import RankMonitor



if __name__ == '__main__':
    oom = OomMonitor('logcat')
    monitor = RankMonitor('rank')

    oom.run_until_finish()
    monitor.run_until_finish()

    info = monitor.get_info()
    df_rank = pd.DataFrame(info['rank'])
    df_mem = pd.DataFrame(info['mem'])
    df_oom = oom.get_info()

    view = EchartView(df_rank, df_mem, df_oom)
    view.save('procrank.csv')
    view.show('procrank.html')
